package com.zmn.plat.services.impl.product.tariff.group;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zmn.plat.model.entity.product.tariff.group.ProductTariffGroup;
import com.zmn.plat.model.entity.product.tariff.group.ProductTariffGroupQuery;
import com.zmn.plat.model.vo.product.tariff.group.ProductTariffGroupVO;
import com.zmn.plat.persistence.interfaces.product.tariff.group.ProductTariffGroupDao;
import com.zmn.plat.services.interfaces.product.tariff.group.ProductTariffGroupService;

@Service
public class ProductTariffGroupServiceImpl implements ProductTariffGroupService {

    @Resource
    ProductTariffGroupDao productFaultGroupDao;

    @Override
    public ProductTariffGroup findByKey(Integer relateId) {
        return productFaultGroupDao.findByKey(relateId);
    }

    @Override
    public List<ProductTariffGroup> listPageByQuery(ProductTariffGroupQuery query) {
        int count = countByQuery(query);
        query.setTotalCount(count);
        return productFaultGroupDao.listPageByQuery(query);
    }

    @Override
    public List<ProductTariffGroupVO> listByQuery(ProductTariffGroupQuery query) {
        return productFaultGroupDao.listByQuery(query);
    }

    @Override
    public List<ProductTariffGroup> listAll() {
        return productFaultGroupDao.listAll();
    }

    @Override
    public List<ProductTariffGroup> listByGroupIds(List<Integer> faultGroupIds) {
        return productFaultGroupDao.listByGroupIds(faultGroupIds);
    }

    @Override
    public Integer countByQuery(ProductTariffGroupQuery query) {
        return productFaultGroupDao.countByQuery(query);
    }

    @Override
    public Integer updateByKey(ProductTariffGroup productFaultGroup) {
        return productFaultGroupDao.updateByKey(productFaultGroup);
    }

    @Override
    public Integer insert(ProductTariffGroup productFaultGroup) {
        return productFaultGroupDao.insert(productFaultGroup);
    }

    @Override
    public Integer insertBatch(List<ProductTariffGroup> productFaultGroupList) {
        return productFaultGroupDao.insertBatch(productFaultGroupList);
    }

    @Override
    public Integer deleteByKey(Integer relateId) {
        return productFaultGroupDao.deleteByKey(relateId);
    }

    @Override
    public Integer deleteByProductIdAndTariffId(Integer productId, Integer tariffId) {
        return productFaultGroupDao.deleteByProductIdAndTariffId(productId, tariffId);
    }

    @Override
    public Integer deleteByGroupIds(List<Integer> faultGroupIds) {
        return productFaultGroupDao.deleteByGroupIds(faultGroupIds);
    }
}